package Day7;

public class Rectangle extends Shape{
    private int width;
    private int height;
    public Rectangle(){

    }
    public Rectangle(Point position,int width,int height){
        super(position);
        this.width=width;
        this.height=height;
        setPosition(position);

    }

    @Override
    public double area(){
        return width*height;
    }

    @Override
    public boolean container(Point p){
        return p.getX()>=this.getPosition().getX()&&p.getX()<=this.getPosition().getX()+width&&p.getY()>=this.getPosition().getY()&&p.getY()<=this.getPosition().getY()+height;
    }

    public int getWidth(){
        return width;
    }
    public void setWidth(int width){
        this.width=width;
    }
}
